import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {NzMessageService} from 'ng-zorro-antd';

@Component({
  selector: 'app-quick-add',
  templateUrl: './quick-add.component.html'
})
export class QuickAddComponent implements OnInit {
  @Output() add = new EventEmitter<string>();

  constructor(
    private message: NzMessageService
  ) {
  }

  ngOnInit() {
  }

  addTodo(title: string): void {
    title = title.trim();
    if (!title) {
      this.message.error('请输入你想做的事情');
      return;
    }
    this.add.emit(title);
  }
}
